﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using DataInfo;
using KenLib.BusinessManager;

public partial class APP_frmA_CompBranchInput : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = @"実習実施場所情報登録";
        ((APP_MasterPage_appCom)this.Master).changeTitle("実習実施場所情報登録");
        ((APP_MasterPage_appCom)this.Master).HideLiArea("frmA_CompBranchInput");

        if (!IsPostBack)
        {
            
            if (Session["役"] == null || Session["役"] == "")
            {
                //if (Session["役"] == "1")
                //{
                    Response.Redirect("~/frmD_Login.aspx");
            }
            else
            {
                Get_拠点コード();
                CheckUpdate_To_ComBranchInfo();
                getSession();
                    
                    
            }
            //}
           


        }


        if (Session["役"] != null || Session["役"] != "")
        {
            if (Session["役"] == "1")
            {
                Response.Redirect("~/frmD_Login.aspx");
            }
            else
            {
                //getSession();// Session dung de show thong tin khi nguoi dung click button btn_戻る_Click o trang CompBrachCheck de quay ve trang CompBranchInput.aspx.
                //ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "regis", "Disable();FormLoad();", true);
                if (txt_拠点コード.SelectedValue == "-1")
                {
                    SetTextChilds(this.Page);
                    DisableChilds(this.Page);
                    txt_拠点コード.Attributes.Add("onChange", "return checkConfirm()");
                    //Response.Write("123");
                }
                else
                {
                    EnableChilds(this.Page);
                }
                if (Session["Update_ComBranchInFo_To_CompBranchInput"] != null)
                {
                    btn_次.Visible = true;
                }
                
                txt_拠点コード.Focus();
                hdf_textbox1.Value = textbox1.Text;
                hdf_textbox2.Value = textbox1.Text;
                hdf_textbox3.Value = textbox1.Text;
                
                validatetxt_実習実施場所.ErrorMessage =  GetError("ER00001");
                validatetxt_フリガナ.ErrorMessage = GetError("ER00001");
                validatetxt_郵便番号.ErrorMessage = GetError("ER00001");
                validatetxt_住所.ErrorMessage =  GetError("ER00001");
                validatetxt_住所フリガナ.ErrorMessage = GetError("ER00001");
                validatetxt_電話番号.ErrorMessage =  GetError("ER00001");
                validatetxt_電話番号_M1.ErrorMessage = GetError("ER00001");
                validatetxt_電話番号_M2.ErrorMessage = GetError("ER00001");
                //Regular_validatetxt_電話番号.ErrorMessage = "電話番号" + GetError("ER00002");
                //Regular_validatetxt_電話番号_M1.ErrorMessage = "電話番号" + GetError("ER00002");
                //Regular_validatetxt_電話番号_M2.ErrorMessage = "電話番号" + GetError("ER00002");
                validatetxt_FAX番号.ErrorMessage =  GetError("ER00001");
                //Regular_validatetxt_FAX番号.ErrorMessage = "FAX番号" + GetError("ER00002");
                //Regular_validatetxt_FAX番号_M1.ErrorMessage = "FAX番号" + GetError("ER00002");
                //Regular_validatetxt_FAX番号_M2.ErrorMessage = "FAX番号" + GetError("ER00002");
                validatetxt_FAX番号_M1.ErrorMessage = GetError("ER00001");
                validatetxt_FAX番号_M2.ErrorMessage = GetError("ER00001");
                validatetxt_氏名1.ErrorMessage = GetError("ER00001");
                validatetxt_フリガナ1.ErrorMessage = GetError("ER00001");
                validatetxt_部署名1.ErrorMessage =  GetError("ER00001");
                validatetxt_部署名フリガナ1.ErrorMessage = GetError("ER00001");
                validatetxt_1役職1.ErrorMessage =  GetError("ER00001");
                validatetxt_メールアドレス1.ErrorMessage = GetError("ER00001");
                validatetxt_電話番号1.ErrorMessage =  GetError("ER00001");
                validatetxt_電話番号1_M1.ErrorMessage =  GetError("ER00001");
                validatetxt_電話番号1_M2.ErrorMessage =  GetError("ER00001");
                //Regular_validatetxt_電話番号1.ErrorMessage = "電話番号" + GetError("ER00002");
                //Regular_validatetxt_電話番号1_M1.ErrorMessage = "電話番号" + GetError("ER00002");
                //Regular_validatetxt_電話番号1_M2.ErrorMessage = "電話番号" + GetError("ER00002");
                //validatetxt_携帯電話番号1.ErrorMessage = "携帯電話番号" + GetError("ER00001");
                //validatetxt_携帯電話番号1_M1.ErrorMessage = "携帯電話番号" + GetError("ER00001");
                //validatetxt_携帯電話番号1_M2.ErrorMessage = "携帯電話番号" + GetError("ER00001");
                //Regular_validatetxt_携帯電話番号1.ErrorMessage = "携帯電話番号" + GetError("ER00002");
                //Regular_validatetxt_携帯電話番号1_M1.ErrorMessage = "携帯電話番号" + GetError("ER00002");
                //Regular_validatetxt_携帯電話番号1_M2.ErrorMessage = "携帯電話番号" + GetError("ER00002");
                validatetxt_氏名2.ErrorMessage = GetError("ER00001");
                validatetxt_フリガナ2.ErrorMessage = GetError("ER00001");
                validatetxt_部署名2.ErrorMessage =  GetError("ER00001");
                validatetxt_部署名フリガナ2.ErrorMessage = GetError("ER00001");
                validatetxt_役職2.ErrorMessage = GetError("ER00001");
                validatetxt_メールアドレス2.ErrorMessage =  GetError("ER00001");
                validatetxt_直通ＴＥＬ2.ErrorMessage =  GetError("ER00001");
                validatetxt_直通ＴＥＬ2_M1.ErrorMessage =  GetError("ER00001");
                validatetxt_直通ＴＥＬ2_M2.ErrorMessage =  GetError("ER00001");
                //Regular_validatetxt_直通ＴＥＬ2.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ2_M1.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ2_M2.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                validatetxt_携帯ＴＥＬ2.ErrorMessage =  GetError("ER00001");
                validatetxt_携帯ＴＥＬ2_M1.ErrorMessage =  GetError("ER00001");
                validatetxt_携帯ＴＥＬ2_M2.ErrorMessage =  GetError("ER00001");
                //Regular_validatetxt_携帯ＴＥＬ2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ2_M1.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ2_M2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                validatetextbox1.ErrorMessage = GetError("ER00001");
                //regular1.ErrorMessage = GetError("ER00006");
                CustomValidator4.ErrorMessage =  GetError("ER00006");
                CustomValidator1.ErrorMessage =  GetError("ER00005");
                //validatetxt_通算経験年数.ErrorMessage = "通算経験年数" + GetError("ER00001");
                validatetxt_氏名3.ErrorMessage = GetError("ER00001");
                validatetxt_フリガナ3.ErrorMessage = GetError("ER00001");
                validatetxt_部署名3.ErrorMessage =  GetError("ER00001");
                validatetxt_部署名フリガナ3.ErrorMessage = GetError("ER00001");
                validatetxt_役職3.ErrorMessage =  GetError("ER00001");
                //validatetxt_メールアドレス3.ErrorMessage = "メールアドレス" + GetError("ER00001");
                validatetxt_直通ＴＥＬ3.ErrorMessage = GetError("ER00001");
                validatetxt_直通ＴＥＬ3_M1.ErrorMessage = GetError("ER00001");
                validatetxt_直通ＴＥＬ3_M2.ErrorMessage = GetError("ER00001");
                //Regular_validatetxt_直通ＴＥＬ3.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ3_M1.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ3_M2.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //validatetxt_携帯ＴＥＬ3.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //validatetxt_携帯ＴＥＬ3_M1.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //validatetxt_携帯ＴＥＬ3_M2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //Regular_validatetxt_携帯ＴＥＬ3.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ3_M1.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ3_M2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                validatetextbox2.ErrorMessage = GetError("ER00001");
                //regular2.ErrorMessage = "就任年月日" + GetError("ER00006");
                CustomValidator5.ErrorMessage =  GetError("ER00006");
                CustomValidator2.ErrorMessage =  GetError("ER00006");
                validatetxt_氏名4.ErrorMessage = GetError("ER00001");
                validatetxt_フリガナ4.ErrorMessage = GetError("ER00001");
                validatetxt_部署名4.ErrorMessage =  GetError("ER00001");
                valiadatetxt_部署名フリガナ4.ErrorMessage = GetError("ER00001");
                validatetxt_役職4.ErrorMessage = GetError("ER00001");
                //validatetxt_メールアドレス.ErrorMessage = "メールアドレス" + GetError("ER00001");
                validatetxt_直通ＴＥＬ4.ErrorMessage =  GetError("ER00001");
                validatetxt_直通ＴＥＬ4_M1.ErrorMessage = GetError("ER00001");
                validatetxt_直通ＴＥＬ4_M2.ErrorMessage = GetError("ER00001");
                //Regular_validatetxt_直通ＴＥＬ4.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ4_M1.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_直通ＴＥＬ4_M2.ErrorMessage = "直通ＴＥＬ" + GetError("ER00002");
                //validatetxt_携帯ＴＥＬ4.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //validatetxt_携帯ＴＥＬ4_M1.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //validatetxt_携帯ＴＥＬ4_M2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00001");
                //Regular_validatetxt_携帯ＴＥＬ4.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ4_M1.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                //Regular_validatetxt_携帯ＴＥＬ4_M2.ErrorMessage = "携帯ＴＥＬ" + GetError("ER00002");
                validatetextbox3.ErrorMessage = GetError("ER00001");
                //regular3.ErrorMessage = "就任年月日" + GetError("ER00006");
                CustomValidator6.ErrorMessage = GetError("ER00006");
                CustomValidator3.ErrorMessage = GetError("ER00006");
                regular_email.ErrorMessage =  GetError("ER00002");
                regular_email1.ErrorMessage = GetError("ER00002");
                //regular_email2.ErrorMessage = "メールアドレス" + GetError("ER00002");
                //regular_email3.ErrorMessage = "メールアドレス" + GetError("ER00002");
                CustomValidator10.ErrorMessage = GetError("ER00002");
                CustomValidator11.ErrorMessage = GetError("ER00002");
                RegularExpressionValidator1.ErrorMessage = GetError("ER00002");
                CustomValidator7.ErrorMessage =  GetError("ER00001");
                CustomValidator8.ErrorMessage =  GetError("ER00001");
                CustomValidator9.ErrorMessage =  GetError("ER00001");
                CustomValidator12.ErrorMessage = GetError("ER00001");
                CustomValidator13.ErrorMessage = GetError("ER00001");
                CustomValidator14.ErrorMessage = GetError("ER00001");
                CustomValidator15.ErrorMessage = GetError("ER00001");
                CustomValidator16.ErrorMessage = GetError("ER00001");
                CustomValidator17.ErrorMessage = GetError("ER00001");
                CustomValidator34.ErrorMessage = GetError("ER00009");
                CustomValidator18.ErrorMessage = GetError("ER00005");
                CustomValidator19.ErrorMessage = GetError("ER00005");
                CustomValidator20.ErrorMessage = GetError("ER00005");
            }
        }
    }

    private void DisableChilds(Control ctrl)
    {
        foreach (Control c in ctrl.Controls)
        {
            DisableChilds(c);
            if (c is TextBox)
            {
                ((TextBox)(c)).Enabled = false;
            }
        }
    }
    private void EnableChilds(Control ctrl)
    {
        foreach (Control c in ctrl.Controls)
        {
            EnableChilds(c);
            if (c is TextBox)
            {
                ((TextBox)(c)).Enabled = true;
            }
        }
    }
    private void SetTextChilds(Control ctrl)
    {
        foreach (Control c in ctrl.Controls)
        {
            SetTextChilds(c);
            if (c is TextBox)
            {
                ((TextBox)(c)).Text = "";
            }
        }
    }    



    protected void btn_確認_Click(object sender, EventArgs e)
    {
        
        if (Session["Update_ComBranchInFo_To_CompBranchInput"] != null)
        {
            if (CustomValidator34.IsValid == true && CustomValidator18.IsValid == true && CustomValidator19.IsValid == true && CustomValidator20.IsValid == true)
            {
                List<List<String>> list = new List<List<String>>();
                String[] varList = Request.Form.AllKeys;
                for (int i = 3; i < varList.Length; i++)
                {
                    string controlName = varList[i];
                    string value = Request.Params.Get(controlName).Replace("<", "&lt;");
                    value = value.Replace(">", "&gt;");
                    string serverControlName = controlName.Replace("ctl00$ContentPlaceHolder1$", "");
                    List<String> val = new List<String>();
                    val.Add(serverControlName);
                    val.Add(value);
                    list.Add(val);
                }

                Session["listValue_CompBranchInfo_To_CompBranchInput"] = list;
                Session.Remove("拠点コード");
                //Session["拠点ID"] = txt_拠点コード.SelectedValue.ToString();
                Response.Redirect("frmA_CompBranchCheck.aspx");
            }
        }

        else 
        {
            if (CustomValidator34.IsValid == true && CustomValidator18.IsValid == true && CustomValidator19.IsValid == true && CustomValidator20.IsValid == true)
            {
                List<List<String>> list = new List<List<String>>();
                String[] varList = Request.Form.AllKeys;
                for (int i = 3; i < varList.Length; i++)
                {
                    string controlName = varList[i];
                    string value = Request.Params.Get(controlName).Replace("<", "&lt;");
                    value = value.Replace(">", "&gt;");
                    string serverControlName = controlName.Replace("ctl00$ContentPlaceHolder1$", "");
                    List<String> val = new List<String>();
                    val.Add(serverControlName);
                    val.Add(value);
                    list.Add(val);
                }

                Session["listValueCompBranchInput"] = list;
                Session["拠点ID"] = txt_拠点コード.SelectedValue.ToString();
                Session.Remove("拠点コード");

                Response.Redirect("frmA_CompBranchCheck.aspx");
            }
        }
    }

    protected void CustomValidate実習実施場所(object source, ServerValidateEventArgs args)
    {
        try
        {
            拠点情報Manager frm = new 拠点情報Manager();
            DataTable dt = new DataTable();
            int 拠点ID = Int32.Parse( txt_拠点コード.SelectedValue.ToString());
            int 企業ID = Int32.Parse(Session["企業コード_2"].ToString());
            dt = frm.Check拠点情報_CompBranchInput(企業ID, 拠点ID);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (txt_実習実施場所.Text.ToString() == row["拠点名"].ToString())
                    {
                        args.IsValid = false;
                        return;
                    }
                    else
                    {
                        args.IsValid = true;
                    }
                }
            }
            else
            {
                args.IsValid = true;
            }


        }
        catch { }
    }
    protected void CustomValidateCheckDate(object source, ServerValidateEventArgs args)
    {
        try
        {
            本社情報Manager frm = new 本社情報Manager();
            DataTable dt = new DataTable();
            DataTable dt1 = new DataTable();
            dt = frm.Select_MCompManager(Int32.Parse(Session["企業コード_2"].ToString()));
            string check = dt.Rows[0][0].ToString();
            if (check == null || check == "")
            {
                args.IsValid = true;
            }
            else
            {
                dt1 = frm.CheckDateCompBranchInput(Int32.Parse(Session["企業コード_2"].ToString()));
                if (DateTime.Parse(textbox1.Text.ToString()).Date < DateTime.Parse(dt1.Rows[0][0].ToString()).Date)
                {
                    args.IsValid = false;
                    return;
                }
                else
                {
                    args.IsValid = true;
                }
            }
        }
        catch { }
    }


    protected void CustomValidateCheckDate1(object source, ServerValidateEventArgs args)
    {
        try
        {
            本社情報Manager frm = new 本社情報Manager();
            DataTable dt = new DataTable();
            DataTable dt1 = new DataTable();
            dt = frm.Select_MCompManager(Int32.Parse(Session["企業コード_2"].ToString()));
            string check = dt.Rows[0][0].ToString();
            if (check == null || check == "")
            {
                args.IsValid = true;
            }
            else
            {
                dt1 = frm.CheckDateCompBranchInput(Int32.Parse(Session["企業コード_2"].ToString()));
                if (DateTime.Parse(textbox2.Text.ToString()).Date < DateTime.Parse(dt1.Rows[0][0].ToString()).Date)
                {
                    args.IsValid = false;
                    return;
                }
                else
                {
                    args.IsValid = true;
                }
            }
        }
        catch { }
    }


    protected void CustomValidateCheckDate2(object source, ServerValidateEventArgs args)
    {
        try
        {
            本社情報Manager frm = new 本社情報Manager();
            DataTable dt = new DataTable();
            DataTable dt1 = new DataTable();
            dt = frm.Select_MCompManager(Int32.Parse(Session["企業コード_2"].ToString()));
            string check = dt.Rows[0][0].ToString();
            if (check == null || check == "")
            {
                args.IsValid = true;
            }
            else
            {
                dt1 = frm.CheckDateCompBranchInput(Int32.Parse(Session["企業コード_2"].ToString()));
                if (DateTime.Parse(textbox3.Text.ToString()).Date < DateTime.Parse(dt1.Rows[0][0].ToString()).Date)
                {
                    args.IsValid = false;
                    return;
                }
                else
                {
                    args.IsValid = true;
                }
            }
        }
        catch { }
    }






    public String GetError(string errorid) // ham dung de lay ma loi hien thi thong tin cua loi do.
    {
        Error er = new Error();
        er.ErrorID = errorid;
        ErrorManager frm_error = new ErrorManager();
        DataTable dt = frm_error.getError(er);
        return dt.Rows[0][2].ToString();
    }
    protected void btn_リセット_Click(object sender, EventArgs e)
    {
        //if (Session["Update_ComBranchInFo_To_CompBranchInput"] != null)
        //{
            //Session.Remove("listValue_CompBranchInfo_To_CompBranchInput");
            //this.CheckUpdate_To_ComBranchInfo();
        //}
        //else
        //{
            //Session.Remove("listValueCompBranchInput");
            //Response.Redirect("frmA_CompBranchInput.aspx");
            this.getSession();
        //}
    }
    public void getSession()// Session dung de show thong tin khi nguoi dung click button btn_戻る_Click o trang CompBrachCheck de quay ve trang CompBranchInput.aspx.
    {
        if (Session["listValueCompBranchInput"] != null)
        {
            List<List<String>> list = new List<List<String>>();
            list = (System.Collections.Generic.List<List<String>>)Session["listValueCompBranchInput"];

            foreach (List<String> str in list)
            {
                if (str[0] == "txt_拠点コード")
                {
                    txt_拠点コード.SelectedValue = Session["拠点ID"].ToString(); //str[1];
                }

                if (str[0] == "txt_実習実施場所")
                {
                    txt_実習実施場所.Text = str[1];
                }

                if (str[0] == "txt_英語名")
                {
                    txt_英語名.Text = str[1];
                }

                if (str[0] == "txt_フリガナ")
                {
                    txt_フリガナ.Text = str[1];
                }
                if (str[0] == "txt_郵便番号")
                {
                    txt_郵便番号.Text = str[1];
                }

                if (str[0] == "txt_住所")
                {
                    txt_住所.Text = str[1];
                }

                if (str[0] == "txt_住所フリガナ")
                {
                    txt_住所フリガナ.Text = str[1];
                }

                //Truong dien thoai

                if (str[0] == "txt_電話番号")
                {
                    txt_電話番号.Text = str[1];
                }

                if (str[0] == "txt_電話番号_M1")
                {
                    txt_電話番号_M1.Text = str[1].ToString();
                }

                if (str[0] == "txt_電話番号_M2")
                {
                    txt_電話番号_M2.Text = str[1];
                }


                // truong fax
                if (str[0] == "txt_FAX番号")
                {
                    txt_FAX番号.Text = str[1];
                }
                if (str[0] == "txt_FAX番号_M1")
                {
                    txt_FAX番号_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_FAX番号_M2")
                {
                    txt_FAX番号_M2.Text = str[1];
                }




                if (str[0] == "txt_氏名1")
                {
                    txt_氏名1.Text = str[1];
                }


                if (str[0] == "txt_フリガナ1")
                {
                    txt_フリガナ1.Text = str[1];
                }

                if (str[0] == "txt_部署名1")
                {
                    txt_部署名1.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ1")
                {
                    txt_部署名フリガナ1.Text = str[1];
                }

                if (str[0] == "txt_1役職1")
                {
                    txt_1役職1.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス1")
                {
                    txt_メールアドレス1.Text = str[1];
                }
                // truong dien thoai
                if (str[0] == "txt_電話番号1")
                {
                    txt_電話番号1.Text = str[1];
                }
                if (str[0] == "txt_電話番号1_M1")
                {
                    txt_電話番号1_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_電話番号1_M2")
                {
                    txt_電話番号1_M2.Text = str[1];
                }

                // truong dtdd
                if (str[0] == "txt_携帯電話番号1")
                {
                    txt_携帯電話番号1.Text = str[1];
                }
                if (str[0] == "txt_携帯電話番号1_M1")
                {
                    txt_携帯電話番号1_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯電話番号1_M2")
                {
                    txt_携帯電話番号1_M2.Text = str[1];
                }


                if (str[0] == "txt_氏名2")
                {
                    txt_氏名2.Text = str[1];
                }

                if (str[0] == "txt_フリガナ2")
                {
                    txt_フリガナ2.Text = str[1];
                }

                if (str[0] == "txt_部署名2")
                {
                    txt_部署名2.Text = str[1];
                }


                if (str[0] == "txt_部署名フリガナ2")
                {
                    txt_部署名フリガナ2.Text = str[1];
                }

                if (str[0] == "txt_役職2")
                {
                    txt_役職2.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス2")
                {
                    txt_メールアドレス2.Text = str[1];
                }

                // truong dien thoai
                if (str[0] == "txt_直通ＴＥＬ2")
                {
                    txt_直通ＴＥＬ2.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ2_M1")
                {
                    txt_直通ＴＥＬ2_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ2_M2")
                {
                    txt_直通ＴＥＬ2_M2.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ2")
                {
                    txt_携帯ＴＥＬ2.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ2_M1")
                {
                    txt_携帯ＴＥＬ2_M1.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ2_M2")
                {
                    txt_携帯ＴＥＬ2_M2.Text = str[1];
                }



                if (str[0] == "textbox1")
                {
                    textbox1.Text = str[1];
                }

                if (str[0] == "txt_通算経験年数")
                {
                    txt_通算経験年数.Text = str[1];
                }

                if (str[0] == "txt_氏名3")
                {
                    txt_氏名3.Text = str[1];
                }

                if (str[0] == "txt_フリガナ3")
                {
                    txt_フリガナ3.Text = str[1];
                }

                if (str[0] == "txt_部署名3")
                {
                    txt_部署名3.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ3")
                {
                    txt_部署名フリガナ3.Text = str[1];
                }

                if (str[0] == "txt_役職3")
                {
                    txt_役職3.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス3")
                {
                    txt_メールアドレス3.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_直通ＴＥＬ3")
                {
                    txt_直通ＴＥＬ3.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ3_M1")
                {
                    txt_直通ＴＥＬ3_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ3_M2")
                {
                    txt_直通ＴＥＬ3_M2.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ3")
                {
                    txt_携帯ＴＥＬ3.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ3_M1")
                {
                    txt_携帯ＴＥＬ3_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯ＴＥＬ3_M2")
                {
                    txt_携帯ＴＥＬ3_M2.Text = str[1].ToString();
                }


                if (str[0] == "textbox2")
                {
                    textbox2.Text = str[1];
                }

                if (str[0] == "txt_氏名4")
                {
                    txt_氏名4.Text = str[1];
                }

                if (str[0] == "txt_フリガナ4")
                {
                    txt_フリガナ4.Text = str[1];
                }

                if (str[0] == "txt_部署名4")
                {
                    txt_部署名4.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ4")
                {
                    txt_部署名フリガナ4.Text = str[1];
                }

                if (str[0] == "txt_役職4")
                {
                    txt_役職4.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス")
                {
                    txt_メールアドレス.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_直通ＴＥＬ4")
                {
                    txt_直通ＴＥＬ4.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ4_M1")
                {
                    txt_直通ＴＥＬ4_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ4_M2")
                {
                    txt_直通ＴＥＬ4_M2.Text = str[1];
                }

                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ4")
                {
                    txt_携帯ＴＥＬ4.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ4_M1")
                {
                    txt_携帯ＴＥＬ4_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯ＴＥＬ4_M2")
                {
                    txt_携帯ＴＥＬ4_M2.Text = str[1];
                }


                if (str[0] == "textbox3")
                {
                    textbox3.Text = str[1];
                }

            }
        }
        else if (Session["listValue_CompBranchInfo_To_CompBranchInput"] != null)
        {
            List<List<String>> list = new List<List<String>>();
            list = (System.Collections.Generic.List<List<String>>)Session["listValue_CompBranchInfo_To_CompBranchInput"];

            foreach (List<String> str in list)
            {
                //if (str[0] == "txt_拠点コード")
                //{
                txt_拠点コード.Enabled = false;
                txt_拠点コード.SelectedValue = Session["ID_CompBranchInput"].ToString(); //str[1];
                //}

                if (str[0] == "txt_実習実施場所")
                {
                    txt_実習実施場所.Text = str[1];
                }
                if (str[0] == "txt_英語名")
                {
                    txt_英語名.Text = str[1];
                }
                
                if (str[0] == "txt_フリガナ")
                {
                    txt_フリガナ.Text = str[1];
                }
                if (str[0] == "txt_郵便番号")
                {
                    txt_郵便番号.Text = str[1];
                }

                if (str[0] == "txt_住所")
                {
                    txt_住所.Text = str[1];
                }

                if (str[0] == "txt_住所フリガナ")
                {
                    txt_住所フリガナ.Text = str[1];
                }

                //Truong dien thoai

                if (str[0] == "txt_電話番号")
                {
                    txt_電話番号.Text = str[1];
                }

                if (str[0] == "txt_電話番号_M1")
                {
                    txt_電話番号_M1.Text = str[1].ToString();
                }

                if (str[0] == "txt_電話番号_M2")
                {
                    txt_電話番号_M2.Text = str[1];
                }


                // truong fax
                if (str[0] == "txt_FAX番号")
                {
                    txt_FAX番号.Text = str[1];
                }
                if (str[0] == "txt_FAX番号_M1")
                {
                    txt_FAX番号_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_FAX番号_M2")
                {
                    txt_FAX番号_M2.Text = str[1];
                }




                if (str[0] == "txt_氏名1")
                {
                    txt_氏名1.Text = str[1];
                }


                if (str[0] == "txt_フリガナ1")
                {
                    txt_フリガナ1.Text = str[1];
                }

                if (str[0] == "txt_部署名1")
                {
                    txt_部署名1.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ1")
                {
                    txt_部署名フリガナ1.Text = str[1];
                }

                if (str[0] == "txt_1役職1")
                {
                    txt_1役職1.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス1")
                {
                    txt_メールアドレス1.Text = str[1];
                }
                // truong dien thoai
                if (str[0] == "txt_電話番号1")
                {
                    txt_電話番号1.Text = str[1];
                }
                if (str[0] == "txt_電話番号1_M1")
                {
                    txt_電話番号1_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_電話番号1_M2")
                {
                    txt_電話番号1_M2.Text = str[1];
                }

                // truong dtdd
                if (str[0] == "txt_携帯電話番号1")
                {
                    txt_携帯電話番号1.Text = str[1];
                }
                if (str[0] == "txt_携帯電話番号1_M1")
                {
                    txt_携帯電話番号1_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯電話番号1_M2")
                {
                    txt_携帯電話番号1_M2.Text = str[1];
                }


                if (str[0] == "txt_氏名2")
                {
                    txt_氏名2.Text = str[1];
                }

                if (str[0] == "txt_フリガナ2")
                {
                    txt_フリガナ2.Text = str[1];
                }

                if (str[0] == "txt_部署名2")
                {
                    txt_部署名2.Text = str[1];
                }


                if (str[0] == "txt_部署名フリガナ2")
                {
                    txt_部署名フリガナ2.Text = str[1];
                }

                if (str[0] == "txt_役職2")
                {
                    txt_役職2.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス2")
                {
                    txt_メールアドレス2.Text = str[1];
                }

                // truong dien thoai
                if (str[0] == "txt_直通ＴＥＬ2")
                {
                    txt_直通ＴＥＬ2.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ2_M1")
                {
                    txt_直通ＴＥＬ2_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ2_M2")
                {
                    txt_直通ＴＥＬ2_M2.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ2")
                {
                    txt_携帯ＴＥＬ2.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ2_M1")
                {
                    txt_携帯ＴＥＬ2_M1.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ2_M2")
                {
                    txt_携帯ＴＥＬ2_M2.Text = str[1];
                }



                if (str[0] == "textbox1")
                {
                    textbox1.Text = str[1];
                }

                if (str[0] == "txt_通算経験年数")
                {
                    txt_通算経験年数.Text = str[1];
                }

                if (str[0] == "txt_氏名3")
                {
                    txt_氏名3.Text = str[1];
                }

                if (str[0] == "txt_フリガナ3")
                {
                    txt_フリガナ3.Text = str[1];
                }

                if (str[0] == "txt_部署名3")
                {
                    txt_部署名3.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ3")
                {
                    txt_部署名フリガナ3.Text = str[1];
                }

                if (str[0] == "txt_役職3")
                {
                    txt_役職3.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス3")
                {
                    txt_メールアドレス3.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_直通ＴＥＬ3")
                {
                    txt_直通ＴＥＬ3.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ3_M1")
                {
                    txt_直通ＴＥＬ3_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ3_M2")
                {
                    txt_直通ＴＥＬ3_M2.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ3")
                {
                    txt_携帯ＴＥＬ3.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ3_M1")
                {
                    txt_携帯ＴＥＬ3_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯ＴＥＬ3_M2")
                {
                    txt_携帯ＴＥＬ3_M2.Text = str[1].ToString();
                }


                if (str[0] == "textbox2")
                {
                    textbox2.Text = str[1];
                }

                if (str[0] == "txt_氏名4")
                {
                    txt_氏名4.Text = str[1];
                }

                if (str[0] == "txt_フリガナ4")
                {
                    txt_フリガナ4.Text = str[1];
                }

                if (str[0] == "txt_部署名4")
                {
                    txt_部署名4.Text = str[1];
                }

                if (str[0] == "txt_部署名フリガナ4")
                {
                    txt_部署名フリガナ4.Text = str[1];
                }

                if (str[0] == "txt_役職4")
                {
                    txt_役職4.Text = str[1];
                }

                if (str[0] == "txt_メールアドレス")
                {
                    txt_メールアドレス.Text = str[1];
                }


                // truong dt
                if (str[0] == "txt_直通ＴＥＬ4")
                {
                    txt_直通ＴＥＬ4.Text = str[1];
                }
                if (str[0] == "txt_直通ＴＥＬ4_M1")
                {
                    txt_直通ＴＥＬ4_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_直通ＴＥＬ4_M2")
                {
                    txt_直通ＴＥＬ4_M2.Text = str[1];
                }

                // truong dt
                if (str[0] == "txt_携帯ＴＥＬ4")
                {
                    txt_携帯ＴＥＬ4.Text = str[1];
                }
                if (str[0] == "txt_携帯ＴＥＬ4_M1")
                {
                    txt_携帯ＴＥＬ4_M1.Text = str[1].ToString();
                }
                if (str[0] == "txt_携帯ＴＥＬ4_M2")
                {
                    txt_携帯ＴＥＬ4_M2.Text = str[1];
                }


                if (str[0] == "textbox3")
                {
                    textbox3.Text = str[1];
                }

            }
        }
        else if (Session["拠点コード"] != null)
        {
            拠点情報Manager frm = new 拠点情報Manager();
            DataTable dt = new DataTable();
            dt = frm.Select_Get拠点コード_CompBranchInput(Int32.Parse(txt_拠点コード.SelectedValue.ToString()));
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    txt_実習実施場所.Text = row["拠点名"].ToString();
                    txt_英語名.Text = row["拠点名英語"].ToString();
                    txt_フリガナ.Text = row["拠点名フリガナ"].ToString();
                    txt_郵便番号.Text = row["郵便番号"].ToString();
                    txt_住所.Text = row["住所"].ToString();
                    txt_住所フリガナ.Text = row["住所フリガナ"].ToString();

                    if (row["ＴＥＬ"].ToString() != "")
                    {
                        string strTel1 = row["ＴＥＬ"].ToString();
                        string[] strArrayTel1 = strTel1.Split('-');
                        txt_電話番号.Text = strArrayTel1[0].ToString();
                        txt_電話番号_M1.Text = strArrayTel1[1].ToString();
                        txt_電話番号_M2.Text = strArrayTel1[2].ToString();

                    }
                    else
                    {
                        txt_電話番号.Text = "";
                        txt_電話番号_M1.Text = "";
                        txt_電話番号_M2.Text = "";
                    }
                    if (row["FAX"].ToString() != "")
                    {
                        string strTel2 = row["FAX"].ToString();
                        string[] strArrayTel2 = strTel2.Split('-');
                        txt_FAX番号.Text = strArrayTel2[0].ToString();
                        txt_FAX番号_M1.Text = strArrayTel2[1].ToString();
                        txt_FAX番号_M2.Text = strArrayTel2[2].ToString();

                    }
                    else
                    {
                        txt_FAX番号.Text = "";
                        txt_FAX番号_M1.Text = "";
                        txt_FAX番号_M2.Text = "";
                    }
                    txt_氏名1.Text = row["担当１氏名"].ToString();
                    txt_フリガナ1.Text = row["担当１氏名フリガナ"].ToString();
                    txt_部署名1.Text = row["担当１部署名"].ToString();
                    txt_部署名フリガナ1.Text = row["担当１部署名フリガナ"].ToString();
                    txt_1役職1.Text = row["担当１役職"].ToString();
                    txt_メールアドレス1.Text = row["担当１メールアドレス"].ToString();


                    if (row["担当１直通ＴＥＬ"].ToString() != "")
                    {

                        string strTel3 = row["担当１直通ＴＥＬ"].ToString();
                        string[] strArrayTel3 = strTel3.Split('-');
                        txt_電話番号1.Text = strArrayTel3[0].ToString();
                        txt_電話番号1_M1.Text = strArrayTel3[1].ToString();
                        txt_電話番号1_M2.Text = strArrayTel3[2].ToString();

                    }
                    else
                    {
                        txt_電話番号1.Text = "";
                        txt_電話番号1_M1.Text = "";
                        txt_電話番号1_M2.Text = "";
                    }

                    if (row["担当１携帯ＴＥＬ"].ToString() != "")
                    {

                        string strTel4 = row["担当１携帯ＴＥＬ"].ToString();
                        string[] strArrayTel4 = strTel4.Split('-');
                        txt_携帯電話番号1.Text = strArrayTel4[0].ToString();
                        txt_携帯電話番号1_M1.Text = strArrayTel4[1].ToString();
                        txt_携帯電話番号1_M2.Text = strArrayTel4[2].ToString();

                    }
                    else
                    {
                        txt_携帯電話番号1.Text = "";
                        txt_携帯電話番号1_M1.Text = "";
                        txt_携帯電話番号1_M2.Text = "";
                    }
                    txt_氏名2.Text = row["担当２氏名"].ToString();
                    txt_フリガナ2.Text = row["担当２氏名フリガナ"].ToString();
                    txt_部署名2.Text = row["担当２部署名"].ToString();
                    txt_部署名フリガナ2.Text = row["担当２部署名フリガナ"].ToString();
                    txt_役職2.Text = row["担当２役職"].ToString();
                    txt_メールアドレス2.Text = row["担当２メールアドレス"].ToString();


                    if (row["担当２直通ＴＥＬ"].ToString() != "")
                    {
                        string strTel5 = row["担当２直通ＴＥＬ"].ToString();
                        string[] strArrayTel5 = strTel5.Split('-');
                        txt_直通ＴＥＬ2.Text = strArrayTel5[0].ToString();
                        txt_直通ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                        txt_直通ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();

                    }
                    else
                    {
                        txt_直通ＴＥＬ2.Text = "";
                        txt_直通ＴＥＬ2_M1.Text = "";
                        txt_直通ＴＥＬ2_M2.Text = "";
                    }
                    if (row["担当２携帯ＴＥＬ"].ToString() != "")
                    {
                        string strTel5 = row["担当２携帯ＴＥＬ"].ToString();
                        string[] strArrayTel5 = strTel5.Split('-');
                        txt_携帯ＴＥＬ2.Text = strArrayTel5[0].ToString();
                        txt_携帯ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                        txt_携帯ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();


                    }
                    else
                    {
                        txt_携帯ＴＥＬ2.Text = "";
                        txt_携帯ＴＥＬ2_M1.Text = "";
                        txt_携帯ＴＥＬ2_M2.Text = "";
                    }
                    textbox1.Text = ConvertDate(row["担当２就任年月日"].ToString());
                    txt_通算経験年数.Text = row["担当2通算経験年数"].ToString();
                    txt_氏名3.Text = row["担当３氏名"].ToString();
                    txt_フリガナ3.Text = row["担当３氏名フリガナ"].ToString();
                    txt_部署名3.Text = row["担当３部署名"].ToString();
                    txt_部署名フリガナ3.Text = row["担当３部署名フリガナ"].ToString();
                    txt_役職3.Text = row["担当３役職"].ToString();
                    txt_メールアドレス3.Text = row["担当３メールアドレス"].ToString();

                    if (row["担当３直通ＴＥＬ"].ToString() != "")
                    {
                        string strTel6 = row["担当３直通ＴＥＬ"].ToString();
                        string[] strArrayTel6 = strTel6.Split('-');
                        txt_直通ＴＥＬ3.Text = strArrayTel6[0].ToString();
                        txt_直通ＴＥＬ3_M1.Text = strArrayTel6[1].ToString();
                        txt_直通ＴＥＬ3_M2.Text = strArrayTel6[2].ToString();


                    }
                    else
                    {
                        txt_直通ＴＥＬ3.Text = "";
                        txt_直通ＴＥＬ3_M1.Text = "";
                        txt_直通ＴＥＬ3_M2.Text = "";
                    }

                    if (row["担当３携帯ＴＥＬ"].ToString() != "")
                    {
                        string strTel7 = row["担当３携帯ＴＥＬ"].ToString();
                        string[] strArrayTel7 = strTel7.Split('-');
                        txt_携帯ＴＥＬ3.Text = strArrayTel7[0].ToString();
                        txt_携帯ＴＥＬ3_M1.Text = strArrayTel7[1].ToString();
                        txt_携帯ＴＥＬ3_M2.Text = strArrayTel7[2].ToString();


                    }
                    else
                    {
                        txt_携帯ＴＥＬ3.Text = "";
                        txt_携帯ＴＥＬ3_M1.Text = "";
                        txt_携帯ＴＥＬ3_M2.Text = "";
                    }
                    textbox2.Text = ConvertDate(row["担当３就任年月日"].ToString());
                    txt_氏名4.Text = row["担当４氏名"].ToString();
                    txt_フリガナ4.Text = row["担当４氏名フリガナ"].ToString();
                    txt_部署名4.Text = row["担当４部署名"].ToString();
                    txt_部署名フリガナ4.Text = row["担当４部署名フリガナ"].ToString();
                    txt_役職4.Text = row["担当４役職"].ToString();
                    txt_メールアドレス.Text = row["担当４メールアドレス"].ToString();

                    if (row["担当４直通ＴＥＬ"].ToString() != "")
                    {
                        string strTel8 = row["担当４直通ＴＥＬ"].ToString();
                        string[] strArrayTel8 = strTel8.Split('-');
                        txt_直通ＴＥＬ4.Text = strArrayTel8[0].ToString();
                        txt_直通ＴＥＬ4_M1.Text = strArrayTel8[1].ToString();
                        txt_直通ＴＥＬ4_M2.Text = strArrayTel8[2].ToString();

                    }
                    else
                    {
                        txt_直通ＴＥＬ4.Text = "";
                        txt_直通ＴＥＬ4_M1.Text = "";
                        txt_直通ＴＥＬ4_M2.Text = "";
                    }

                    if (row["担当４携帯ＴＥＬ"].ToString() != "")
                    {
                        string strTel9 = row["担当４携帯ＴＥＬ"].ToString();
                        string[] strArrayTel9 = strTel9.Split('-');
                        txt_携帯ＴＥＬ4.Text = strArrayTel9[0].ToString();
                        txt_携帯ＴＥＬ4_M1.Text = strArrayTel9[1].ToString();
                        txt_携帯ＴＥＬ4_M2.Text = strArrayTel9[2].ToString();


                    }
                    else
                    {
                        txt_携帯ＴＥＬ4.Text = "";
                        txt_携帯ＴＥＬ4_M1.Text = "";
                        txt_携帯ＴＥＬ4_M2.Text = "";
                    }
                    textbox3.Text = ConvertDate(row["担当４就任年月日"].ToString());
                   
                    //ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "regis", "Disable();FormLoad();", true);
                }

                //}
            }
        }
        else if (Session["Update_ComBranchInFo_To_CompBranchInput"] != null && Session["listValue_CompBranchInfo_To_CompBranchInput"] == null)
        {
            CheckUpdate_To_ComBranchInfo();
        }

        
    }

    public void Get_拠点コード()
    {
        try
        {
            拠点情報Manager frm = new 拠点情報Manager();
            DataTable dt = new DataTable();
            int 企業ID = Int32.Parse(Session["企業コード_2"].ToString()); // Ma cong ty dang nhap CHU Y
            dt = frm.Select_拠点コード(企業ID);
            txt_拠点コード.DataSource = dt;
            txt_拠点コード.DataTextField = "拠点コード";
            txt_拠点コード.DataValueField = "拠点ID";

            txt_拠点コード.DataBind();
            ListItem item = new ListItem("[選択]", "-1");
            item.Selected = true;
            txt_拠点コード.Items.Insert(0, item);
        }
        catch { }
    }
    
    
    protected void txt_電話番号_TextChanged(object sender, EventArgs e)
    {

    }
    protected void txt_拠点コード_SelectedIndexChanged(object sender, EventArgs e)
    {
        
        拠点情報Manager frm = new 拠点情報Manager();
        DataTable dt = new DataTable();
        dt = frm.Select_Get拠点コード_CompBranchInput(Int32.Parse(txt_拠点コード.SelectedValue.ToString()));
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow row in dt.Rows)
            {
                txt_実習実施場所.Text = row["拠点名"].ToString();
                txt_英語名.Text = row["拠点名英語"].ToString();
                txt_フリガナ.Text = row["拠点名フリガナ"].ToString();
                txt_郵便番号.Text = row["郵便番号"].ToString();
                txt_住所.Text = row["住所"].ToString();
                txt_住所フリガナ.Text = row["住所フリガナ"].ToString();

                if (row["ＴＥＬ"].ToString() != "")
                {
                    string strTel1 = row["ＴＥＬ"].ToString();
                    string[] strArrayTel1 = strTel1.Split('-');
                    txt_電話番号.Text = strArrayTel1[0].ToString();
                    txt_電話番号_M1.Text = strArrayTel1[1].ToString();
                    txt_電話番号_M2.Text = strArrayTel1[2].ToString();

                }
                else
                {
                    txt_電話番号.Text = "";
                    txt_電話番号_M1.Text = "";
                    txt_電話番号_M2.Text = "";
                }
                if (row["FAX"].ToString() != "")
                {
                    string strTel2 = row["FAX"].ToString();
                    string[] strArrayTel2 = strTel2.Split('-');
                    txt_FAX番号.Text = strArrayTel2[0].ToString();
                    txt_FAX番号_M1.Text = strArrayTel2[1].ToString();
                    txt_FAX番号_M2.Text = strArrayTel2[2].ToString();

                }
                else
                {
                    txt_FAX番号.Text = "";
                    txt_FAX番号_M1.Text = "";
                    txt_FAX番号_M2.Text = "";
                }
                txt_氏名1.Text = row["担当１氏名"].ToString();
                txt_フリガナ1.Text = row["担当１氏名フリガナ"].ToString();
                txt_部署名1.Text = row["担当１部署名"].ToString();
                txt_部署名フリガナ1.Text = row["担当１部署名フリガナ"].ToString();
                txt_1役職1.Text = row["担当１役職"].ToString();
                txt_メールアドレス1.Text = row["担当１メールアドレス"].ToString();


                if (row["担当１直通ＴＥＬ"].ToString() != "")
                {

                    string strTel3 = row["担当１直通ＴＥＬ"].ToString();
                    string[] strArrayTel3 = strTel3.Split('-');
                    txt_電話番号1.Text = strArrayTel3[0].ToString();
                    txt_電話番号1_M1.Text = strArrayTel3[1].ToString();
                    txt_電話番号1_M2.Text = strArrayTel3[2].ToString();

                }
                else
                {
                    txt_電話番号1.Text = "";
                    txt_電話番号1_M1.Text = "";
                    txt_電話番号1_M2.Text = "";
                }

                if (row["担当１携帯ＴＥＬ"].ToString() != "")
                {

                    string strTel4 = row["担当１携帯ＴＥＬ"].ToString();
                    string[] strArrayTel4 = strTel4.Split('-');
                    txt_携帯電話番号1.Text = strArrayTel4[0].ToString();
                    txt_携帯電話番号1_M1.Text = strArrayTel4[1].ToString();
                    txt_携帯電話番号1_M2.Text = strArrayTel4[2].ToString();

                }
                else
                {
                    txt_携帯電話番号1.Text = "";
                    txt_携帯電話番号1_M1.Text = "";
                    txt_携帯電話番号1_M2.Text = "";
                }
                txt_氏名2.Text = row["担当２氏名"].ToString();
                txt_フリガナ2.Text = row["担当２氏名フリガナ"].ToString();
                txt_部署名2.Text = row["担当２部署名"].ToString();
                txt_部署名フリガナ2.Text = row["担当２部署名フリガナ"].ToString();
                txt_役職2.Text = row["担当２役職"].ToString();
                txt_メールアドレス2.Text = row["担当２メールアドレス"].ToString();


                if (row["担当２直通ＴＥＬ"].ToString() != "")
                {
                    string strTel5 = row["担当２直通ＴＥＬ"].ToString();
                    string[] strArrayTel5 = strTel5.Split('-');
                    txt_直通ＴＥＬ2.Text = strArrayTel5[0].ToString();
                    txt_直通ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                    txt_直通ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();

                }
                else
                {
                    txt_直通ＴＥＬ2.Text = "";
                    txt_直通ＴＥＬ2_M1.Text = "";
                    txt_直通ＴＥＬ2_M2.Text = "";
                }
                if (row["担当２携帯ＴＥＬ"].ToString() != "")
                {
                    string strTel5 = row["担当２携帯ＴＥＬ"].ToString();
                    string[] strArrayTel5 = strTel5.Split('-');
                    txt_携帯ＴＥＬ2.Text = strArrayTel5[0].ToString();
                    txt_携帯ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                    txt_携帯ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();


                }
                else
                {
                    txt_携帯ＴＥＬ2.Text = "";
                    txt_携帯ＴＥＬ2_M1.Text = "";
                    txt_携帯ＴＥＬ2_M2.Text = "";
                }
                textbox1.Text = ConvertDate(row["担当２就任年月日"].ToString());
                txt_通算経験年数.Text = row["担当2通算経験年数"].ToString();
                txt_氏名3.Text = row["担当３氏名"].ToString();
                txt_フリガナ3.Text = row["担当３氏名フリガナ"].ToString();
                txt_部署名3.Text = row["担当３部署名"].ToString();
                txt_部署名フリガナ3.Text = row["担当３部署名フリガナ"].ToString();
                txt_役職3.Text = row["担当３役職"].ToString();
                txt_メールアドレス3.Text = row["担当３メールアドレス"].ToString();

                if (row["担当３直通ＴＥＬ"].ToString() != "")
                {
                    string strTel6 = row["担当３直通ＴＥＬ"].ToString();
                    string[] strArrayTel6 = strTel6.Split('-');
                    txt_直通ＴＥＬ3.Text = strArrayTel6[0].ToString();
                    txt_直通ＴＥＬ3_M1.Text = strArrayTel6[1].ToString();
                    txt_直通ＴＥＬ3_M2.Text = strArrayTel6[2].ToString();


                }
                else
                {
                    txt_直通ＴＥＬ3.Text = "";
                    txt_直通ＴＥＬ3_M1.Text = "";
                    txt_直通ＴＥＬ3_M2.Text = "";
                }

                if (row["担当３携帯ＴＥＬ"].ToString() != "")
                {
                    string strTel7 = row["担当３携帯ＴＥＬ"].ToString();
                    string[] strArrayTel7 = strTel7.Split('-');
                    txt_携帯ＴＥＬ3.Text = strArrayTel7[0].ToString();
                    txt_携帯ＴＥＬ3_M1.Text = strArrayTel7[1].ToString();
                    txt_携帯ＴＥＬ3_M2.Text = strArrayTel7[2].ToString();


                }
                else
                {
                    txt_携帯ＴＥＬ3.Text = "";
                    txt_携帯ＴＥＬ3_M1.Text = "";
                    txt_携帯ＴＥＬ3_M2.Text = "";
                }
                textbox2.Text = ConvertDate(row["担当３就任年月日"].ToString());
                txt_氏名4.Text = row["担当４氏名"].ToString();
                txt_フリガナ4.Text = row["担当４氏名フリガナ"].ToString();
                txt_部署名4.Text = row["担当４部署名"].ToString();
                txt_部署名フリガナ4.Text = row["担当４部署名フリガナ"].ToString();
                txt_役職4.Text = row["担当４役職"].ToString();
                txt_メールアドレス.Text = row["担当４メールアドレス"].ToString();

                if (row["担当４直通ＴＥＬ"].ToString() != "")
                {
                    string strTel8 = row["担当４直通ＴＥＬ"].ToString();
                    string[] strArrayTel8 = strTel8.Split('-');
                    txt_直通ＴＥＬ4.Text = strArrayTel8[0].ToString();
                    txt_直通ＴＥＬ4_M1.Text = strArrayTel8[1].ToString();
                    txt_直通ＴＥＬ4_M2.Text = strArrayTel8[2].ToString();

                }
                else
                {
                    txt_直通ＴＥＬ4.Text = "";
                    txt_直通ＴＥＬ4_M1.Text = "";
                    txt_直通ＴＥＬ4_M2.Text = "";
                }

                if (row["担当４携帯ＴＥＬ"].ToString() != "")
                {
                    string strTel9 = row["担当４携帯ＴＥＬ"].ToString();
                    string[] strArrayTel9 = strTel9.Split('-');
                    txt_携帯ＴＥＬ4.Text = strArrayTel9[0].ToString();
                    txt_携帯ＴＥＬ4_M1.Text = strArrayTel9[1].ToString();
                    txt_携帯ＴＥＬ4_M2.Text = strArrayTel9[2].ToString();


                }
                else
                {
                    txt_携帯ＴＥＬ4.Text = "";
                    txt_携帯ＴＥＬ4_M1.Text = "";
                    txt_携帯ＴＥＬ4_M2.Text = "";
                }
                textbox3.Text = ConvertDate(row["担当４就任年月日"].ToString());
                h1.Value = txt_拠点コード.SelectedValue.ToString();
                Session["拠点コード"] = h1.Value.ToString();
                //ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "regis", "Disable();FormLoad();", true);
            }

            //}
        }
       
       
    }



    public void CheckUpdate_To_ComBranchInfo()
    {
        try
        {
            if (Session["Update_ComBranchInFo_To_CompBranchInput"] != null && Session["listValue_CompBranchInfo_To_CompBranchInput"] == null)
            {
                拠点情報Manager frm = new 拠点情報Manager();
                DataTable dt = new DataTable();
                dt = frm.Select_Get拠点コード_CompBranchInput(Int32.Parse(Session["ID_CompBranchInput"].ToString()));
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        txt_拠点コード.Enabled = false;
                        txt_拠点コード.SelectedValue = Session["ID_CompBranchInput"].ToString();
                        txt_実習実施場所.Text = row["拠点名"].ToString();
                        txt_英語名.Text = row["拠点名英語"].ToString();
                        txt_フリガナ.Text = row["拠点名フリガナ"].ToString();
                        txt_郵便番号.Text = row["郵便番号"].ToString();
                        txt_住所.Text = row["住所"].ToString();
                        txt_住所フリガナ.Text = row["住所フリガナ"].ToString();

                        if (row["ＴＥＬ"].ToString() != "")
                        {
                            string strTel1 = row["ＴＥＬ"].ToString();
                            string[] strArrayTel1 = strTel1.Split('-');
                            txt_電話番号.Text = strArrayTel1[0].ToString();
                            txt_電話番号_M1.Text = strArrayTel1[1].ToString();
                            txt_電話番号_M2.Text = strArrayTel1[2].ToString();

                        }
                        else
                        {
                            txt_電話番号.Text = "";
                            txt_電話番号_M1.Text = "";
                            txt_電話番号_M2.Text = "";
                        }
                        if (row["FAX"].ToString() != "")
                        {
                            string strTel2 = row["FAX"].ToString();
                            string[] strArrayTel2 = strTel2.Split('-');
                            txt_FAX番号.Text = strArrayTel2[0].ToString();
                            txt_FAX番号_M1.Text = strArrayTel2[1].ToString();
                            txt_FAX番号_M2.Text = strArrayTel2[2].ToString();

                        }
                        else
                        {
                            txt_FAX番号.Text = "";
                            txt_FAX番号_M1.Text = "";
                            txt_FAX番号_M2.Text = "";
                        }
                        txt_氏名1.Text = row["担当１氏名"].ToString();
                        txt_フリガナ1.Text = row["担当１氏名フリガナ"].ToString();
                        txt_部署名1.Text = row["担当１部署名"].ToString();
                        txt_部署名フリガナ1.Text = row["担当１部署名フリガナ"].ToString();
                        txt_1役職1.Text = row["担当１役職"].ToString();
                        txt_メールアドレス1.Text = row["担当１メールアドレス"].ToString();


                        if (row["担当１直通ＴＥＬ"].ToString() != "")
                        {

                            string strTel3 = row["担当１直通ＴＥＬ"].ToString();
                            string[] strArrayTel3 = strTel3.Split('-');
                            txt_電話番号1.Text = strArrayTel3[0].ToString();
                            txt_電話番号1_M1.Text = strArrayTel3[1].ToString();
                            txt_電話番号1_M2.Text = strArrayTel3[2].ToString();

                        }
                        else
                        {
                            txt_電話番号1.Text = "";
                            txt_電話番号1_M1.Text = "";
                            txt_電話番号1_M2.Text = "";
                        }

                        if (row["担当１携帯ＴＥＬ"].ToString() != "")
                        {

                            string strTel4 = row["担当１携帯ＴＥＬ"].ToString();
                            string[] strArrayTel4 = strTel4.Split('-');
                            txt_携帯電話番号1.Text = strArrayTel4[0].ToString();
                            txt_携帯電話番号1_M1.Text = strArrayTel4[1].ToString();
                            txt_携帯電話番号1_M2.Text = strArrayTel4[2].ToString();

                        }
                        else
                        {
                            txt_携帯電話番号1.Text = "";
                            txt_携帯電話番号1_M1.Text = "";
                            txt_携帯電話番号1_M2.Text = "";
                        }
                        txt_氏名2.Text = row["担当２氏名"].ToString();
                        txt_フリガナ2.Text = row["担当２氏名フリガナ"].ToString();
                        txt_部署名2.Text = row["担当２部署名"].ToString();
                        txt_部署名フリガナ2.Text = row["担当２部署名フリガナ"].ToString();
                        txt_役職2.Text = row["担当２役職"].ToString();
                        txt_メールアドレス2.Text = row["担当２メールアドレス"].ToString();


                        if (row["担当２直通ＴＥＬ"].ToString() != "")
                        {
                            string strTel5 = row["担当２直通ＴＥＬ"].ToString();
                            string[] strArrayTel5 = strTel5.Split('-');
                            txt_直通ＴＥＬ2.Text = strArrayTel5[0].ToString();
                            txt_直通ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                            txt_直通ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();

                        }
                        else
                        {
                            txt_直通ＴＥＬ2.Text = "";
                            txt_直通ＴＥＬ2_M1.Text = "";
                            txt_直通ＴＥＬ2_M2.Text = "";
                        }
                        if (row["担当２携帯ＴＥＬ"].ToString() != "")
                        {
                            string strTel5 = row["担当２携帯ＴＥＬ"].ToString();
                            string[] strArrayTel5 = strTel5.Split('-');
                            txt_携帯ＴＥＬ2.Text = strArrayTel5[0].ToString();
                            txt_携帯ＴＥＬ2_M1.Text = strArrayTel5[1].ToString();
                            txt_携帯ＴＥＬ2_M2.Text = strArrayTel5[2].ToString();


                        }
                        else
                        {
                            txt_携帯ＴＥＬ2.Text = "";
                            txt_携帯ＴＥＬ2_M1.Text = "";
                            txt_携帯ＴＥＬ2_M2.Text = "";
                        }
                        textbox1.Text = ConvertDate(row["担当２就任年月日"].ToString());
                        txt_通算経験年数.Text = row["担当2通算経験年数"].ToString();
                        txt_氏名3.Text = row["担当３氏名"].ToString();
                        txt_フリガナ3.Text = row["担当３氏名フリガナ"].ToString();
                        txt_部署名3.Text = row["担当３部署名"].ToString();
                        txt_部署名フリガナ3.Text = row["担当３部署名フリガナ"].ToString();
                        txt_役職3.Text = row["担当３役職"].ToString();
                        txt_メールアドレス3.Text = row["担当３メールアドレス"].ToString();

                        if (row["担当３直通ＴＥＬ"].ToString() != "")
                        {
                            string strTel6 = row["担当３直通ＴＥＬ"].ToString();
                            string[] strArrayTel6 = strTel6.Split('-');
                            txt_直通ＴＥＬ3.Text = strArrayTel6[0].ToString();
                            txt_直通ＴＥＬ3_M1.Text = strArrayTel6[1].ToString();
                            txt_直通ＴＥＬ3_M2.Text = strArrayTel6[2].ToString();


                        }
                        else
                        {
                            txt_直通ＴＥＬ3.Text = "";
                            txt_直通ＴＥＬ3_M1.Text = "";
                            txt_直通ＴＥＬ3_M2.Text = "";
                        }

                        if (row["担当３携帯ＴＥＬ"].ToString() != "")
                        {
                            string strTel7 = row["担当３携帯ＴＥＬ"].ToString();
                            string[] strArrayTel7 = strTel7.Split('-');
                            txt_携帯ＴＥＬ3.Text = strArrayTel7[0].ToString();
                            txt_携帯ＴＥＬ3_M1.Text = strArrayTel7[1].ToString();
                            txt_携帯ＴＥＬ3_M2.Text = strArrayTel7[2].ToString();


                        }
                        else
                        {
                            txt_携帯ＴＥＬ3.Text = "";
                            txt_携帯ＴＥＬ3_M1.Text = "";
                            txt_携帯ＴＥＬ3_M2.Text = "";
                        }
                        textbox2.Text = ConvertDate(row["担当３就任年月日"].ToString());
                        txt_氏名4.Text = row["担当４氏名"].ToString();
                        txt_フリガナ4.Text = row["担当４氏名フリガナ"].ToString();
                        txt_部署名4.Text = row["担当４部署名"].ToString();
                        txt_部署名フリガナ4.Text = row["担当４部署名フリガナ"].ToString();
                        txt_役職4.Text = row["担当４役職"].ToString();
                        txt_メールアドレス.Text = row["担当４メールアドレス"].ToString();

                        if (row["担当４直通ＴＥＬ"].ToString() != "")
                        {
                            string strTel8 = row["担当４直通ＴＥＬ"].ToString();
                            string[] strArrayTel8 = strTel8.Split('-');
                            txt_直通ＴＥＬ4.Text = strArrayTel8[0].ToString();
                            txt_直通ＴＥＬ4_M1.Text = strArrayTel8[1].ToString();
                            txt_直通ＴＥＬ4_M2.Text = strArrayTel8[2].ToString();

                        }
                        else
                        {
                            txt_直通ＴＥＬ4.Text = "";
                            txt_直通ＴＥＬ4_M1.Text = "";
                            txt_直通ＴＥＬ4_M2.Text = "";
                        }

                        if (row["担当４携帯ＴＥＬ"].ToString() != "")
                        {
                            string strTel9 = row["担当４携帯ＴＥＬ"].ToString();
                            string[] strArrayTel9 = strTel9.Split('-');
                            txt_携帯ＴＥＬ4.Text = strArrayTel9[0].ToString();
                            txt_携帯ＴＥＬ4_M1.Text = strArrayTel9[1].ToString();
                            txt_携帯ＴＥＬ4_M2.Text = strArrayTel9[2].ToString();


                        }
                        else
                        {
                            txt_携帯ＴＥＬ4.Text = "";
                            txt_携帯ＴＥＬ4_M1.Text = "";
                            txt_携帯ＴＥＬ4_M2.Text = "";
                        }
                        textbox3.Text = ConvertDate(row["担当４就任年月日"].ToString());
                    }


                }
            }
        }
        catch { }
    }


    




    public string ConvertDate(string str)// ham convert ngay thang nam.
    {
        if (str == "")
        {
            return str = "";
        }
        else
        {
            string date = str;
            DateTime d1 = DateTime.Parse(date);
            d1.Year.ToString();
            return date = d1.ToString("yyyy/MM/dd");
        }
    }
    protected void btn_次_Click(object sender, EventArgs e)
    {
        Session.Remove("Update_ComBranchInFo_To_CompBranchInput");
        string url = "frmA_CompBranchInfo.aspx?";
        url += "ID=" + Session["ID_CompBranchInput"].ToString();
        Session.Remove("ID_CompBranchInput");
        Response.Redirect(url);
    }
}
